You are here: Symbol Reference > Dew Namespace > Dew.Stats Namespace > Dew.Stats.Units Namespace > Classes > Regress Class > Regress Methods > Regress.RidgeRegress Method
Dew Stats for .NET
ContentsIndexHome
PreviousUpNext
Regress.RidgeRegress Method

Regression by using "ridge" regression method.

Syntax
C#
Visual Basic
public static void RidgeRegress([In] TVec Y, [In] TMtx A, double k, [In] TVec b, bool Normalize);

Calculates regression coefficients b by using "ridge regression" method. When data suffers from multicollinearity one of the available methods which can still be used is ridge regression. In this case least squares estimates are unbiased, but their variances are large so they may be far from the true value. By adding a degree of bias to the regression estimates, ridge regression reduces the standard errors. It is hoped that the total effect will be to give more reliable estimates. Ridge regression uses following model: 

y = A*b , 

where y is vector of observations, A matrix of independent variables and b are regression coefficients. Additional k parameter is the so called "ridge parameter". Regression coefficients are then calculated from the following formula: 

b = inv(AT*A + k*I) * (AT*y), 

where I is the identity matrix, A matrix of independent variables and AT=Transp(A). 

Note The routine does NOT calculate optimal k value for ridge regression.

An example of ridge regression method.

using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples { private void Example() { Vector y = new Vector(0); Vector b = new Vector(0); Matrix A = new Matrix(0,0); y.SetIt(false,new double[] {-2.5, 0.1, 6.1}); A.SetIt(3,2,false, new double[] {1.0, 2.5, 3.2, -1.5, 0.4, 0.7}); Regress.RidgeRegress(y,A,0.0,b); // b = (-6.8889789853, -6.450976395) } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!